#include "tcp_server.hpp"
#include <memory>
using namespace std;

using namespace ns_server;

void Usage(std::string name)
{
    std::cout << "使用错误！" << std::endl;
    std::cout << "./" << name << "port" << std::endl;
}

string echo(const string& message)
{
    return message;
}

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(USE_ERR);
    }
    uint16_t port = atoi(argv[1]);
    unique_ptr<tcpServer> tsvr(new tcpServer(echo, port));

    tsvr->initServer();
    tsvr->Start();
    
    return 0;
}